package baseFx.common.mq.rabbitmq;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.net.InetAddress;
import java.util.Map;

public class ConnectionWrapper implements Connection {

    private Connection connection;

    public ConnectionWrapper(Connection connection) {
        this.connection = connection;
    }

    @Override
    public InetAddress getAddress() {
        return connection.getAddress();
    }

    @Override
    public int getPort() {
        return connection.getPort();
    }

    @Override
    public int getChannelMax() {
        return connection.getChannelMax();
    }

    @Override
    public int getFrameMax() {
        return connection.getFrameMax();
    }

    @Override
    public int getHeartbeat() {
        return connection.getHeartbeat();
    }

    @Override
    public Map<String, Object> getClientProperties() {
        return connection.getClientProperties();
    }

    @Override
    public String getClientProvidedName() {
        return connection.getClientProvidedName();
    }

    @Override
    public Map<String, Object> getServerProperties() {
        return connection.getServerProperties();
    }

    @Override
    public Channel createChannel() throws IOException {
        return connection.createChannel();
    }

    @Override
    public Channel createChannel(int i) throws IOException {
        return connection.createChannel(i);
    }

    @Override
    public void close() throws IOException {
        if (connection != null) {
            connection.close();
            connection = null;
        }
    }

    @Override
    public void close(int i, String s) throws IOException {
        connection.close(i, s);
    }

    @Override
    public void close(int i) throws IOException {
        connection.close(i);
    }

    @Override
    public void close(int i, String s, int i1) throws IOException {
        connection.close(i, s, i1);
    }

    @Override
    public void abort() {
        connection.abort();
    }

    @Override
    public void abort(int i, String s) {
        connection.abort(i, s);
    }

    @Override
    public void abort(int i) {
        connection.abort(i);
    }

    @Override
    public void abort(int i, String s, int i1) {
        connection.abort(i, s, i1);
    }

    @Override
    public void addBlockedListener(BlockedListener blockedListener) {
        connection.addBlockedListener(blockedListener);
    }

    @Override
    public BlockedListener addBlockedListener(BlockedCallback blockedCallback, UnblockedCallback unblockedCallback) {
        return connection.addBlockedListener(blockedCallback, unblockedCallback);
    }

    @Override
    public boolean removeBlockedListener(BlockedListener blockedListener) {
        return connection.removeBlockedListener(blockedListener);
    }

    @Override
    public void clearBlockedListeners() {
        connection.clearBlockedListeners();
    }

    @Override
    public ExceptionHandler getExceptionHandler() {
        return connection.getExceptionHandler();
    }

    @Override
    public String getId() {
        return connection.getId();
    }

    @Override
    public void setId(String s) {
        connection.setId(s);
    }

    @Override
    public void addShutdownListener(ShutdownListener shutdownListener) {
        connection.addShutdownListener(shutdownListener);
    }

    @Override
    public void removeShutdownListener(ShutdownListener shutdownListener) {
        connection.removeShutdownListener(shutdownListener);
    }

    @Override
    public ShutdownSignalException getCloseReason() {
        return connection.getCloseReason();
    }

    @Override
    public void notifyListeners() {
        connection.notifyListeners();
    }

    @Override
    public boolean isOpen() {
        return connection.isOpen();
    }
}
